wxRegEx
Table of Contents

For more information, see the on-line wxWidgets documentation:


Several routines require a flags parameter. Valid flags are:

  • func compile_regex(atom regex, sequence pattern, integer flags)   
  • func get_match( atom regex, sequence text, integer index )   
  • func get_match_count( atom regex )   
  • func is_valid_regex( atom regex )   
  • func regex_matches( atom regex, sequence text, integer flags )   
  • func replace_regex( atom regex, sequence text, sequence replacement, integer max_matches, integer in_place )     
     
    Parent Topics:
  • Classes

    wxRegEx
    Table of Contents

    [func]
    compile_regex
    (atom regex, sequence pattern, integer flags)

    Category: wxRegEx

    Create and compile the regular expression, use is_valid_regex to test for compilation errors.

    See Also: get_match, get_match_count, is_valid_regex, regex_matches, replace_regex


    wxRegEx
    Table of Contents

    [func]
    get_match
    ( atom regex, sequence text, integer index )

    Category: wxRegEx

    Get the start index and the length of the match of the expression (if index is 0) or a bracketed subexpression (index different from 0). May only be called after successful call to Matches() and only if wxRE_NOSUB was not used in compile_regex. Returns false if no match or if an error occurred.

    See Also: compile_regex, get_match_count, is_valid_regex, regex_matches, replace_regex


    wxRegEx
    Table of Contents

    [func]
    get_match_count
    ( atom regex )

    Category: wxRegEx

    Returns the size of the array of matches, i.e. the number of bracketed subexpressions plus one for the expression itself, or 0 on error. May only be called after successful call to Compile(). and only if wxRE_NOSUB was not used.

    See Also: compile_regex, get_match, is_valid_regex, regex_matches, replace_regex


    wxRegEx
    Table of Contents

    [func]
    is_valid_regex
    ( atom regex )

    Category: wxRegEx

    Return 1 if this is a valid compiled regular expression, 0 otherwise.

    See Also: compile_regex, get_match, get_match_count, regex_matches, replace_regex


    wxRegEx
    Table of Contents

    [func]
    regex_matches
    ( atom regex, sequence text, integer flags )

    Category: wxRegEx

    Matches the precompiled regular expression against the string text, returns true if matches and false otherwise. Flags may be combination of wxRE_NOTBOL and wxRE_NOTEOL. May only be called after successful call to compile_regex.

    See Also: compile_regex, get_match, get_match_count, is_valid_regex, replace_regex


    wxRegEx
    Table of Contents

    [func]
    replace_regex
    ( atom regex, sequence text, sequence replacement, integer max_matches, integer in_place )

    Category: wxRegEx

    Replaces the current regular expression in the string pointed to by text, with the text in replacement. If in_place is 1, then only the modified text is returned. If in_place is 1, then the return value is a sequence, with the first element the number of replaces made, and the second element the modified text. The replacement text may contain back references \number which will be replaced with the value of the corresponding subexpression in the pattern match. \0 corresponds to the entire match and & is a synonym for it. Backslash may be used to quote itself or & character. max_matches may be used to limit the number of replacements made, setting it to 1, for example, will only replace first occurrence (if any) of the pattern in the text while default value of 0 means replace all.

    See Also: compile_regex, get_match, get_match_count, is_valid_regex, regex_matches